<!--
 * @Descripttion: 
 * @version: 
 * @Author: siebe
 * @Date: 2022-02-18 15:45:23
 * @LastEditors: siebe
 * @LastEditTime: 2022-02-20 16:02:48
-->
{include file="public/header" /}
	<div class="header">
		<span>系统配置</span>
		<button type="button" class="layui-btn layui-btn-sm" onclick="add()">
			<i class="layui-icon layui-icon-add-1"></i>添加
		</button>
		<div></div>
	</div>
	<table class="layui-table">
		<thead>
			<tr>
				<th>ID</th>
				<th>名称</th>
				<th>说明</th>
				<th>类型</th>
				<th>值</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			{volist name="lists" id="vo"}
			<tr>
				<td>{$vo.id}</td>
				<td>{$vo.name}</td>
				<td>{$vo.content}</td>
				<td>{$vo.type}</td>
				<td>{$vo.value}</td>
				<td>
					<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" onclick="edit({$vo.id})">
						<i class="layui-icon">&#xe642;</i>编辑
					</button>
					<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="del({$vo.id})">
						<i class="layui-icon">&#xe640;</i>删除
					</button>
				</td>
			</tr>
			{/volist}
		</tbody>
	</table>
	<script type="text/javascript">
		layui.use(['layer'], function () {
			$ = layui.jquery;
		})
		function add() {
			layer.open({
				type: 2,
				title: '添加',
				shade: 0.3,
				area: ['550px', '500px'],
				content: '{$config.path}config/add'
			})
		}
		function edit(id) {
			layer.open({
				type: 2,
				title: '修改',
				shade: 0.3,
				area: ['550px', '500px'],
				content: '{$config.path}config/edit?id=' + id
			})
		}
		function del(id) {
			layer.confirm('您确定要删除吗？', {
				icon: 3,
				btn: ['确定', '取消']
			}, function () {
				$.get('{$config.path}config/delete?id=' + id, function (res) {
					if (res.error_code == 0) {
						layer.msg(res.msg, { 'icon': 1 });
						setTimeout(function () {
							window.location.reload();
						}, 1000);
					} else {
						layer.msg(res.msg, { 'icon': 2 });
					}
				}, 'json').error(function (res) {
					layer.msg(res.responseJSON.msg, { 'icon': 2 });
				});
			})
		}
	</script>
</body>

</html>